package logic;

public class LBoard {
/*
 * Atributes
 */
	final static int BOARD_SIZE_X = 26;
	final static int BOARD_SIZE_Y = BOARD_SIZE_X;
	
	private LBlock blocks[][];
	private int boardWidth;
	private int boardHeight;

/*
 * Constructors
 */
	public LBoard(){
		initialize_blocks(BOARD_SIZE_X, BOARD_SIZE_Y);
	}
	
	public LBoard(int sizeX, int sizeY){
		initialize_blocks(sizeX, sizeY);
	}

/*
 * Methods
 */
	private void initialize_blocks(int sizeX, int sizeY){
		boardWidth = sizeX;
		boardHeight = sizeY;
		blocks = new LBlock[boardWidth][boardHeight];
		
		for(int i = 0; i < boardWidth; i++){
			for(int j = 0; j < boardHeight; j++){
				blocks[i][j] = new LBlock(LBlock.TYPE_EXTERIOR);
			}
		}
	}
	
	public void damage_block_at(int x, int y, int damage){
		blocks[x][y].set_block_health(-damage);
	}
	
	public void heal_block_at(int x, int y, int heal){
		blocks[x][y].set_block_health(heal);
	}
	
/*
 * Getters
 */
	public LBlock get_block_at(int  x, int y){
		return blocks[x][y];
	}
	
	public int get_board_width(){
		return boardWidth;
	}
	
	public int get_board_height(){
		return boardHeight;
	}

/*
 * Setters
 */
	public void set_block_at(int x, int y, int type){
		blocks[x][y].set_block_type(type);
	}
}
